using System;
using Tarkin.InfrastructureLibrary.Core.Basic;
using Tarkin.InfrastructureLibrary.Tests.Core.Basic.TestUtilities.ConcreteClasses;
using NUnit.Framework;

namespace Tarkin.InfrastructureLibrary.Tests.Core.Basic
{
    /// <summary>
    /// TypeTests is the NUnit TestFixture for the Tarkin.InfrastructureLibrary.Core.Basic.Type class.
    /// </summary>
    [TestFixture]
    public class TypeTests
    {

        [Test]
        public void TestDefaultConstructor ()
        {
            ConcreteType type = new ConcreteType ();

            Assert.IsNotNull ( type );
        }

        [Test]
        public void TestOverloadedConstructor ()
        {
            ConcreteType type = new ConcreteType ( "Type name" );

            Assert.AreEqual ( "Type name", type.Name );
        }

        [Test]
        public void TestOwnedCommentsProperty ()
        {
            ConcreteType type = new ConcreteType ();
            Comment comment = new Comment ( "This is a comment" );

            type.OwnedComments.Add ( comment );

            Assert.AreEqual ( 1, type.OwnedComments.Count );
            Assert.IsTrue ( type.OwnedComments.Contains ( comment ) );
        }

        [Test]
        public void TestPackageProperty ()
        {
            ConcreteType type = new ConcreteType ();
            Package package = new Package ( "Package name" );

            type.Package = package;

            Assert.AreEqual ( "Package name", type.Package.Name );
        }

        [Test]
        public void TestNamePropertyNullValue ()
        {
            ConcreteType type = new ConcreteType ();

            type.Name = null;

            Assert.AreEqual ( String.Empty, type.Name );
        }
    }
}
